-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CR 2375: TimeType.to_readable should display microsecond precision. #197
Conversation
ec6abcf
to
a5805aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thank you!
Could we just force the timespec dt.isoformat(timespec="microseconds")
? Default seems to be auto
which falls back to microseconds in our case, but you never know, and it's also easier to read/understand that way.
You're also going to need to format the file for it to pass CI, and add isoformat
to https://github.com/fprime-community/fprime-tools/blob/devel/.github/actions/spelling/expect.txt for spelling
Feel free to let me know if there is anything else that can be done to improve this |
@Ahmad-Bamba could you please also push the timespec="microseconds" change? |
Ah, I neglected to actually git add that file. My bad |
2d7de7c
to
dbd48ea
Compare
…pe.py with Black. Add isoformat to spellcheck CI"
dbd48ea
to
c572884
Compare
Should be good. Sorry about that! |
@LeStarch would you put a second set of eyes on this ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great solution. Much better than what we had. I confirmed that from Python 3.6 through 3.11 the documentation backs-up the change (this call is supported in all versions)!
Change Description
This change makes the TimeType.to_readable function use datetime.isoformat to convert the datetime object to a human readable format. In doing so, fprime-gds outputs
channel.log
entries with microsecond precision.Rationale
Testing/Review Recommendations
I tested the changes locally by first following the fprime hello world tutorial. Then I installed the local version of fprime-tools, and ran the example project with
fprime-gds
. This produced the following output that I've attached below showing no more accuracy loss inchannel.log
:Compared with before this change:
Future Work
This seems like too a small change to make a unit test for, but I could think of a good way to design one if requested.